/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pruebas;

import javax.swing.*;
import javax.swing.table.*;

public class TableIcon extends JFrame
{
    public TableIcon()
    {
        ImageIcon aboutIcon = new javax.swing.ImageIcon(getClass().getResource("/images/sinfoto.jpg"));
        ImageIcon addIcon = new javax.swing.ImageIcon(getClass().getResource("/images/sinfoto.jpg"));
        ImageIcon copyIcon = new javax.swing.ImageIcon(getClass().getResource("/images/sinfoto.jpg"));

        String[] columnNames = {"Picture", "Description"};
        /*Object[][] data =
        {
            {aboutIcon, "About"},
            {addIcon, "Add"},
            {copyIcon, "Copy"},
        };*/

        DefaultTableModel model = new DefaultTableModel(null, columnNames);
        
        model.addRow(new Object[]{aboutIcon, "About"});
        JTable table = new JTable( model )
        {
            //  Returning the Class of each column will allow different
            //  renderers to be used based on Class
            @Override
            public Class getColumnClass(int column)
            {
                return getValueAt(0, column).getClass();
            }
            
            @Override
            public boolean isCellEditable (int row, int column)
            {
                // Aquí devolvemos true o false según queramos que una celda
                // identificada por fila,columna (row,column), sea o no editable
                /*if (column == 3)
                   return true;*/
                return false;
            }
        };
        table.setRowHeight(0, 50);
        table.getTableHeader().setResizingAllowed(false);//Hace las columnas no resizeables
        table.getTableHeader().setReorderingAllowed(false);//Hace las columnas no reordenables
        table.setPreferredScrollableViewportSize(table.getPreferredSize());
        //table.//
        JScrollPane scrollPane = new JScrollPane( table );
        getContentPane().add( scrollPane );
    }

    public static void main(String[] args)
    {
        TableIcon frame = new TableIcon();
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.pack();
        frame.setVisible(true);
    }

}
